const app = getApp()
const request = require('../../utils/promise.js');
const common = require('../../utils/common.js');
Page({
  data: {
    StatusBar: app.globalData.StatusBar,
    CustomBar: app.globalData.CustomBar,
    WebUrl: app.globalData.weburl,
    arraylist: [],
    searchTxt:''
  },
  onLoad: function (option) {
    console.log('searchtxt',option.searchtxt);
    this.setData({
      searchTxt: option.searchtxt
    });
    var parm = {
      "contentType": '1,2,3',
      "contentTitle": option.searchtxt,
      "pageNum": 1,
      "pageSize": 20,
    };
    request.GET("/mdz/content/contentlist", parm).then(res => {
      console.log(res);
      if (res.data.code == "200") {
        this.setData({
          arraylist: res.data.rows
        });
      }
      else {
        common.CheckErrorForBusiness(res.data.message);
      }
    })
  },
  gotoLessionDetail: function (event) {
    console.log('index1', event.currentTarget.dataset.index);
    console.log('index2', event.currentTarget.dataset.type);
    var url = common.getLessionDetailUrl(event.currentTarget.dataset.index,event.currentTarget.dataset.type);
    console.log('url',url);
    wx.navigateTo({
      url: url,
    })
    
  },
})
